<?php
class test{
     public function a(){
         $this->am=1;
     }
}
 function a(){
    $a=new test();
    $a->a();
    echo $a->am;

 }
$a=new test;
a();